﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;

namespace Bainx.WPF.Extend.Control.Converter
{
    public class ScrollBar_ViewportSizeConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            double u = 0.12;
            double ThumbHeight = 94;
            if (double.Parse(values[2].ToString()) != double.NaN)
            {
                u = ThumbHeight / double.Parse(values[2].ToString());
            }
            double size = 0;
            double Max = double.Parse(values[0].ToString());
            double Min = double.Parse(values[1].ToString());
            size = (Max - Min) * u / (1 - u);
            return size;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
